/**
 * v-textAreaAutoHeight
 * Copyright (c) 2023.09.15
 * 使用指令绑定textarea，实现内容随文本撑开
 */

export default {
  mounted(el, binding, vnode) {
    const textarea = el.querySelector('textarea')
    textarea.addEventListener('focus', (e) => {
      textarea.style.height = e.target.scrollHeight + 'px';
    });
    textarea.addEventListener('input', (e) => {
      textarea.style.height = e.target.scrollHeight + 'px';
    });
  }
}